# -*- coding: utf-8 -*-
# @Time : 2022/1/6 10:49
# @Author : Limusen
# @File : demo_baidu_26

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from common.element_excel_utils import ElementExcelUtils
from common.base_page import BasePage

"====================================="

# driver = webdriver.Chrome()
# driver.implicitly_wait(10)
# driver.get("https://www.baidu.com")

# driver.find_element_by_id("kw").send_keys("测试一下不分离")
# driver.find_element_by_id("su").click()

# time.sleep(2)
# driver.quit()

"====================================="

# driver = webdriver.Chrome()
# driver.implicitly_wait(10)
# driver.get("https://www.baidu.com")

# # 换一种方式 发现这种方法也可行
# kw = (By.ID, "kw")
# su = (By.ID, "su")
#
# driver.find_element(*kw).send_keys("测试一下")
# driver.find_element(*su).click()

# time.sleep(2)
# driver.quit()
"====================================="

# 使用excel中的数据做成关键字进行脚本

driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("https://www.baidu.com")

# 假设我们使用excel里面的数据
element = ElementExcelUtils("baidu", "baidu_page").get_element_info()

kw = element["input_kw"]
su = element["click_su"]
base = BasePage(driver)
base.input(kw, "测试一下")
base.click(su)

"====================================="
